package game.view;

import java.awt.Color;
import java.awt.Font;

import game.model.Block;

/**
 * 基本参数
 *
 * @author 陈渤林
 */
interface BasicParameters {
    Font topicFont = new Font("微软雅黑", Font.BOLD, 50);
    Font scoreFont = new Font("微软雅黑", Font.BOLD, 28);
    Font normalFont = new Font("宋体", Font.PLAIN, 20);
    Font font1 = new Font("宋体", Font.BOLD, 46);
    Font font2 = new Font("宋体", Font.BOLD, 40);
    Font font3 = new Font("宋体", Font.BOLD, 34);
    Font font4 = new Font("宋体", Font.BOLD, 28);
    Font font5 = new Font("宋体", Font.BOLD, 22);
    int normalFontdata = 20;
    int topicFontdata = 30;

    /**
     * 返回指定方块对应的前景色
     *
     * @param x 方块
     * @return 对应的前景色
     */
    static public Color getForeground(Block x) {
        if (x == null) return new Color(0xcdc1b4);
        switch (x.getNumber()) {
            case 2:
            case 4:
                return Color.BLACK;
            default:
                return Color.WHITE;
        }
    }

    /**
     * 返回指定方块对应的背景色
     *
     * @param x 方块
     * @return 对应的背景色
     */
    static public Color getBackground(Block x) {
        if (x == null) return new Color(0xcdc1b4);
        switch (x.getNumber()) {
            case 2:
                return new Color(0xeee4da);
            case 4:
                return new Color(0xede0c8);
            case 8:
                return new Color(0xf2b179);
            case 16:
                return new Color(0xf59563);
            case 32:
                return new Color(0xf67c5f);
            case 64:
                return new Color(0xf65e3b);
            case 128:
                return new Color(0xedcf72);
            case 256:
                return new Color(0xedcc61);
            case 512:
                return new Color(0xedc850);
            case 1024:
                return new Color(0xedc53f);
            case 2048:
                return new Color(0xedc22e);
            case 4096:
                return new Color(0x65da92);
            case 8192:
                return new Color(0x5abc65);
            case 16384:
                return new Color(0x248c51);
            default:
                return new Color(0x248c51);
        }
    }

    /**
     * 返回指定方块对应的字体
     *
     * @param x 方块
     * @return 对应的字体
     */
    static public Font getBlockFont(Block x) {
        if (x == null) return BasicParameters.font1;
        if (x.getNumber() < 10) return BasicParameters.font1;
        if (x.getNumber() < 100) return BasicParameters.font2;
        if (x.getNumber() < 1000) return BasicParameters.font3;
        if (x.getNumber() < 10000) return BasicParameters.font4;

        return BasicParameters.font5;
    }

}